package ${pkgName};

import org.springframework.stereotype.Repository;
import java.util.List;
import com.fire.common.util.WebConstant;

<#list import_list as imports>
import ${imports};
</#list>

@Repository
public class ${className} extends ${extendStr}{
	
	/**
	 * 
	 * @Title: 获得grid所需的list
	 * @author: close
	 * @Description:
	 * @param entity
	 * @return List<MenuEntity>
	 * @throws Exception
	 */	 
	public List<${modebeanClassName}> list(${modebeanClassName} entity)throws Exception{
		return this.getSqlSession().selectList("${sqlmapVisitName}.select", entity);
	}


	/**
	 * 
	 * @Title: 单条查询
	 * @author: close
	 * @Description:
	 * @param entity
	 * @return List<MenuEntity>
	 * @throws Exception
	 */	 	 
	public ${modebeanClassName} search(${modebeanClassName} entity) throws Exception {
		return this.getSqlSession().selectOne("${sqlmapVisitName}.selectOne", entity);
	}
	
	/**
	 * 
	 * @Title: 根据主键获取记录
	 * @author: close
	 * @Description:
	 * @param menu_id
	 * @return
	 * @throws Exception
	 */	 
	public ${modebeanClassName} getById(String ${table.pks[0].column_name}) throws Exception{
		return this.getSqlSession().selectOne("${sqlmapVisitName}.selectByPriKey", ${table.pks[0].column_name});
	}

	/**
	 * @Description: 新增数据
	 * @Title: insert
	 * @author: close
	 * @param id
	 * @throws Exception
	 * @return int 
	 */
	public int insert(${modebeanClassName} entity) throws Exception{
		return this.getSqlSession().insert("${sqlmapVisitName}.insert", entity);
	}

	/**
	 * @Description: 修改数据
	 * @Title: insert
	 * @author: close
	 * @param id
	 * @throws Exception
	 * @return int 
	 */
	public int update(${modebeanClassName} entity) throws Exception{
		return this.getSqlSession().update("${sqlmapVisitName}.update", entity);
	}
	
	/**
	 * @Description: 删除数据
	 * @Title: update
	 * @author: close
	 * @param ${table.tableName}
	 * @throws Exception
	 * @return int 
	 */
	public int delete(List<String> ${table.pks[0].column_name}s) throws Exception{
		return this.getSqlSession().delete("${sqlmapVisitName}.deleteById", ${table.pks[0].column_name}s);
	}	
}
